<!DOCTYPE html>
<html >
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>发情未配</title>
    <link href="../css/mui.min.css" rel="stylesheet" type="text/css">
    <link href="../css/home.page.css" rel="stylesheet" />
    <link href="../bootstrap-select/bootstrap-select.css" rel="stylesheet">
    <link href="../css/bootstrap.min.css" rel="stylesheet" >
	<link href="../css/mui.picker.min.css" rel="stylesheet" >
    <script charset="UTF-8" src="../js/jquery.min.js"></script>
    <script charset="UTF-8" src="../js/config.js"></script>
    <script charset="UTF-8" src="../js/core.js"></script>
    <script charset="UTF-8" src="../js/cipher-core.js"></script>
    <script charset="UTF-8" src="../js/tripledes.js"></script>
    <script charset="UTF-8" src="../js/mode-ecb.js"></script>
    <script charset="UTF-8" src="../js/zepto.min.js"></script>
    <script charset="UTF-8" src="../js/spin.min.js"></script>
    <script charset="UTF-8" src="../js/mui.min.js"></script>
    <script charset="UTF-8" src="../js/testActivityName.js"></script>
    <script charset="UTF-8" src="../js/simple.tool.js"></script>
	<script charset="UTF-8" src="../js/mui.picker.min.js"></script>
    <style>
        label{
            text-align: right;
        }
        .btn-default{
            border-color: snow;
        }
        .form-control{
            -webkit-box-shadow: inset 0 0px 0px rgba(0,0,0,.075);
        }
        .form-group{
            border-bottom: 1px solid #f6f6f6;max-width: 720px;height: 55px;
        }
		.col-xs-4 {
		    width: 35%;
		}
    </style>
</head>
<body class="white-bg" >
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" style="width: 95%;" id="form-nomatch-add"  target="ifr">
        <div class="form-group" style="margin-bottom: 0px;border-bottom: 0px solid #f6f6f6;">
            <div class="head-jnx" onclick="record()">
                <img src="../img/fanhui@3x.png" />
                <p>发情未配</p>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">耳号：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <select name="cowId" class="selectpicker form-control m-b" data-live-search="true"  data-size="10" title="选择耳号" id="overbit"  required>
                </select>
            </div>
        </div>
		 <div class="form-group">
            <label class="col-xs-4 control-label">发情日期：<span style="color: red">*</span></label>
            <div class="col-xs-7">
                <div class="input-group date">
                    <!--<span class="input-group-addon"><i class="fa fa-calendar"></i></span>-->
                    <input id="estrusTime" type="text" onfocus=this.blur() onclick="dtPicker('estrusTime')">
                </div>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">未配原因：</label>
            <div class="col-xs-7">
                <select name="unmatchedReasonsId"  style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" id="unmatchedReasonsId">
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">发现人：</label>
            <div class="col-xs-7">
                <select name="discoverer" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" id="discoverer">
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">审核员：</label>
            <div class="col-xs-7">
                <select name="verifyPeople" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" id="verifyPeople">
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">发现方式:</label>
            <div class="col-xs-7">
                <select name="foundTheWayId" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" id="foundTheWayId">
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">发情类型:</label>
            <div class="col-xs-7">
                <select name="oestrusTypeId" style="/* display: table-cell; */vertical-align: middle;text-align: left;width: 100%;" id="oestrusTypeId">
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-xs-4 control-label">备注：</label>
            <div class="col-xs-7">
                <input name="remake" class="form-control" type="text" placeholder="请输入" >
            </div>
        </div>
        <div class="form-group">
            <div style="width: 320px; margin: auto;">
                <div class="quxiao-btn" style="margin-right: 15px;" onclick="record()">取消</div>
                <input type="submit" value="保存信息" class="quxiao-btn" style="background: #0078fb; color: #FFFFFF;border-radius: 55px;" >
                <div class="clear"></div>
            </div>
        </div>
    </form>
</div>
<iframe name='ifr' id="ifr" style='display: none;'></iframe><!--表单提交防止刷新-->
<script src="../js/bootstrap.min.js"></script>
<script src="../bootstrap-select/bootstrap-select.js"></script>
<script type="text/javascript">
    window.onload=breedLoad();
	
	var mapS={}
	mapS.url="getsynestrusdata";
	var overbitList=ajaxRequestPostS(mapS);
	function myfunction(){
		
	}
	var i = setTimeout(function(){
		overbitList = JSON.parse(localStorage.getItem('getsynestrusdata'));
	    if(overbitList != 0){
			loadSelect('overbit',overbitList,'cow_id','overbit');//耳号
			$('.selectpicker').selectpicker('refresh');
		}
	},900);
	
	
    function breedLoad() {//获得下拉数据
		var resultData = JSON.parse(localStorage.getItem('addnomatchdata'));
        breedHtml(resultData.data);
		
		$("#estrusTime").val(getDateNow());
    }
    $("#form-nomatch-add").submit(function () {
        map={};
        map=$('#form-nomatch-add').serializeObject();
        map.url="addnomatch";
        map.overbit=$("#overbit option:selected").text();
        var resultData=ajaxRequestPostSubmit(map);
        if (resultData.head.info == "增加成功") {
            setTimeout(function () {
                record();
            }, 1000);
        }
    });
    function record() {//返回记录
        window.location = "../记录.html";
    }
    function breedHtml(resultData) {//加载下拉
		var userName = resultData.realName;
        
        var unmatchedList=resultData.unmatchedList;
        loadSelect('unmatchedReasonsId',unmatchedList,'code','name');//未配原因
        var breederList=resultData.breederList;
        loadSelect('discoverer',breederList,'real_name','real_name',userName);//发现人
        loadSelect('verifyPeople',breederList,'real_name','real_name',userName);//审核人员
        var foundTheWayList=resultData.foundTheWayList;
        loadSelect('foundTheWayId',foundTheWayList,'code','name');//发现方式
        var oestrusTypeList=resultData.oestrusTypeList;
        loadSelect('oestrusTypeId',oestrusTypeList,'code','name');//发现类型
        $('.selectpicker').selectpicker('refresh');
    }
    function loadSelect(id,data,code,name,userName) {
        $("#"+id).html("");
        $("#"+id).append("<option value=''>请选择</option>");
        for (i=0;i<data.length;i++){//
            var str='';
			if(userName != null && data[i][name] == userName){
				str='<option value="'+data[i][code]+'" selected>'+data[i][name]+'</option>';
			}else{
				str='<option value="'+data[i][code]+'">'+data[i][name]+'</option>';
			}
            $("#"+id).append(str);
        }
    }
	
	
</script>
</body>
</html>